package com.sensePlusVR.utils;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

/**
 * 
 * @author: Loren
 * @create: 2016-7-20上午11:30:08
 * @desc: 获取屏幕分辨率
 */
@SuppressLint("InlinedApi")
@SuppressWarnings("deprecation")
public class AppUtil {
    
	public static int[] getScreenDispaly(Context context) {
    	WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
		int width = windowManager.getDefaultDisplay().getWidth();// 手机屏幕的宽度
		int height = windowManager.getDefaultDisplay().getHeight();// 手机屏幕的高度
		int result[] = { width, height };
		return result;
	}
    
	/**
	 * 隐藏Android底部的虚拟按键
	 */
	public static void hideVirtualKey(Activity context){
		Window window = context.getWindow();
		WindowManager.LayoutParams params = window.getAttributes();
		params.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE;
		window.setAttributes(params);
		window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 
		
	}
    
}
